<HTML><HEAD><TITLE>sorted(?List, ?Sorted)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(ic_global)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>sorted(?List, ?Sorted)</H1>
Sorted is a sorted permutation of List
<DL>
<DT><EM>List</EM></DT>
<DD>List of domain variables or integers
</DD>
<DT><EM>Sorted</EM></DT>
<DD>List of domain variables or integers
</DD>
</DL>
<H2>Description</H2>
    Declaratively: The two lists have the same length and Sorted is a
    sorted permutation of List.
<P>
    Operationally:  the elements in both lists are constrained such
    that their domains are consistent with the assumption that the
    list Sorted is the sorted version of the list List.
<P>
    One of the two arguments can be uninstantiated or partial lists
    at call time.
<P>
    Any input variables which do not already have finite bounds will
    be given default bounds of -10000000 to 10000000.
    
<H3>Modes and Determinism</H3><UL>
<LI>sorted(+, +)
<LI>sorted(+, -)
<LI>sorted(-, +)
</UL>
<H2>Examples</H2>
<PRE>
    ?- length(Xs,4), Xs::0..100, sorted(Xs,Ys), Xs = [8,20|_].

    Xs = [8, 20, _340{[0..100]}, _353{[0..100]}]
    Ys = [_431{[0..8]}, _413{[0..20]}, _523{[8..100]}, _621{[20..100]}]


    ?- length(Ys,4), Ys::0..100, sorted(Xs,Ys), Ys = [8,20|_].

    Xs = [_464{[8..100]}, _477{[8..100]}, _490{[8..100]}, _503{[8..100]}]
    Ys = [8, 20, _340{[20..100]}, _353{[20..100]}]
    </PRE>
<H2>See Also</H2>
<A HREF="../../lib/ic_global/sorted-3.html">sorted / 3</A>, <A HREF="../../lib/ic_global/ordered-2.html">ordered / 2</A>
</BODY></HTML>
